<template>
	<view class="main">
		<view class="list">
			<view class="item">
				<view class="item-left">头像</view>
				<image :src="userInfo.avatar"  class="item-img"></image>
				
			</view>
			<view class="item">
				<view class="item-left">性别</view>
				<view class="item-right">{{sexName[userInfo.sex]}}</view>
			</view>

			<view class="item">
				<view class="item-left">身份证号</view>
				<view class="item-right">{{userInfo.card}}</view>
			</view>

			<view class="item">
				<view class="item-left">地址</view>
				<view class="item-right">{{userInfo.address}}</view>
			</view>
			<view class="item">
				<view class="item-left">我的身份</view>
				<view class="item-right" >
				
				<span v-if="userInfo.roles.length" v-for="item in userInfo.roles">{{item.roleName+' '}} </span>
				</view>
			</view>
			<view class="item">
				<view class="item-left">年龄</view>
				<view class="item-right">{{userInfo.age}}</view>
			</view>
			<view class="item">
				<view class="item-left">联系电话</view>
				<view class="item-right">{{userInfo.tel}}</view>
			</view>
			<view class="item">
				<view class="item-left">应急电话</view>
				<view class="item-right">{{userInfo.emergencyCall}}</view>
			</view>
			<view class="item">
				<view class="item-left">开户银行</view>
				<view class="item-right">{{userInfo.bankName}}</view>
			</view>
			<view class="item">
				<view class="item-left">银行卡号</view>
				<view class="item-right">{{userInfo.bankCard}}</view>
			</view>

		</view>

	</view>
</template>


<script>
	export default {
		data() {
			return {
				userInfo: {},
				sexName:{
					0:'男',
					1:'女'
				}
			}
		},
		onLoad() {
			this.getInfo()
		},

		methods: {
			getInfo() {
				let that = this
				this.$postjson('/api/user/getInfo', {}).then(res => {
					let data = res.data.data
					this.userInfo = data
				})
			},
		},


	}
</script>

<style lang="scss" scoped>
	page {
		background: #F9F9F9;
	}

	.main {
		padding-bottom: 120upx;
	}

	.list {
		width: calc(100% - 48upx);
		margin-top: 20upx;
		margin-left: 24upx;
		margin-right: 24upx;
		border-radius: 10rpx;
		background: #FFFFFF;

		.item {
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-family: PingFangSC, PingFang SC;
			font-size: 30rpx;
			font-weight: 500;
			color: #111111;
			height: 122upx;
			width: calc(100% - 60upx);
			margin: 0 30upx;
			border-bottom: solid 1upx rgba(228, 228, 228, 1);
		}

		.item-right {
			font-family: PingFangSC, PingFang SC;
			font-size: 28rpx;
			font-weight: normal;
			color: #999999;
		}

		.item-img {
			width: 80upx;
			height: 80upx;
			border-radius: 50%;
		}

		.item:last-child {
			border-bottom: none;
		}
	}
</style>